package com.isay.frameworklib.user;

import android.text.TextUtils;

import com.isay.frameworklib.utils.PreferencesUtils;

/**
 * Created by cywu4 on 2018/12/18.
 */
public class UserManager {

    private static String USER_NAME;
    private static String USER_PWD;
    private static String PHPSESSID = "";

    public static String getUserName() {
        if (TextUtils.isEmpty(USER_NAME)) {
            USER_NAME = PreferencesUtils.getString("key_user_name", "");
        }
        return USER_NAME;
    }

    public static void setUserName(String userName) {
        if (!TextUtils.equals(userName, USER_NAME)) {
            USER_NAME = userName;
            PreferencesUtils.put("key_user_name", userName);
        }
    }

    public static String getUserPwd() {
        if (TextUtils.isEmpty(USER_PWD)) {
            USER_PWD = PreferencesUtils.getString("key_user_pwd", "");
        }
        return USER_PWD;
    }

    public static void setUserPwd(String userPwd) {
        if (!TextUtils.equals(userPwd, USER_PWD)) {
            USER_PWD = userPwd;
            PreferencesUtils.put("key_user_pwd", userPwd);
        }
    }


    public static String getPHPSESSID() {
        return PHPSESSID;
    }

    public static void setPHPSESSID(String phpssid) {
        PHPSESSID = phpssid;
    }
}
